]>
Commit | Line | Data |
---|---|---|
6d26a6bd P |
1 | # Determine the potential (inside and outside) of a charged sphere (radius R) with a constant internal charge density rho0. |
2 | # | |
3 | # phi(r)'' = -rho0/epsilon0 - 2/r * phi(r)' | |
4 | # with rho0 = 0 outside of sphere | |
5 | # using t as variable for r | |
6 | # | |
7 | # compound functions used: | |
8 | # Open Amplifier | |
9 | define openamp (weight*: variable-1, weight*: variable-2) -> output | |
10 | isum (weight*: variable-1, weight*: variable-2) -> output | |
11 | connect (FB:) -> GND | |
12 | ||
13 | # Division | |
14 | define idivide (numerator, denominator) -> -quotient | |
15 | openamp (numerator, product) -> -quotient | |
16 | multiply (-quotient, denominator) -> product | |
17 | ||
18 | # coefficients | |
19 | coefficient.1 -> factor0,2 # shall be set to 0.2 | |
20 | coefficient.2 (-1) -> -rho0/epsilon0 | |
21 | coefficient.3 (-1) -> -phi0 | |
22 | coefficinet.4 (-1) -> -R # -radius of sphere | |
23 | ||
24 | # generate a ramp of t | |
25 | iintegrate (-1) -> t | |
26 | ||
27 | # distinguish in sphere or outside | |
28 | compare (t, -R) -> -rho/epsilon0_l | |
29 | LT0: -rho/epsilon0 # in sphere, | |
30 | GT0: GND # outside sphere | |
31 | ||
32 | # calculate phi | |
33 | iintegrate (1*: -rho0/epsilon0_l, 10*: -0.2/r*phi') -> -phi' # need 2/r*phi' thus 10* input | |
34 | iintegrate (-phi') -> phi | |
35 | IC: -phi0 | |
36 | invert(-phi') -> phi' | |
37 | ||
38 | # doing this division by t first because phi' is low when also t is, thus there is the chance of less overload | |
39 | idivide (phi', t) -> -phi'/t | |
40 | cmultiply (-phi'/t, factor0.2) -> -0.2/r*phi' | |
41 | ||
42 | output(t) -> out.x | |
43 | output(phi') -> out.y | |
44 | output(phi) -> out.z |